<!DOCTYPE html>
<html xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0"/>
    <title>Title</title>
    <script src="/js/common.js"></script>
</head>
<style>

    .navbar{
        background: #d2edf4;
        background-image: linear-gradient(to bottom, #f5807d, #e1e5f0 100%);
        margin-bottom: 0px;
    }
</style>
<!--头部导航栏-->
<body style="background-image: none">
<nav class="navbar navbar-default" id="app1">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-5" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#"></a>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-5">
            <p class="navbar-text navbar-right" v-if="isLogin==0"> <a  href="javascript:top.document.location.href='/login'">去登陆
            </a></p>
            <p class="navbar-text navbar-right" v-if="isLogin==1"> <a  href="##" onclick="quit();">退出登陆
            </a></p>
            <p class="navbar-text navbar-right" v-if="isLogin==1"> <a v-bind:class="menu.toUserInfo" href="##" onclick="toUserInfo();">查看个人信息
            </a></p>
            <!--<p class="navbar-text navbar-right" v-if="isLogin==1"> <a v-bind:class="menu.toComment" href="##" onclick="toComment();">留言
            </a></p>-->
            <p class="navbar-text navbar-right" v-if="isLogin==1"> <a v-bind:class="menu.toBill" href="##" onclick="toBill();">查看我的账单
            </a></p>
            <p class="navbar-text navbar-right" v-if="isLogin==1"> <a v-bind:class="menu.toCar" href="##" onclick="toCar();">查看我的购物车
            </a></p>
            <p class="navbar-text navbar-right"> <a href="##" v-bind:class="menu.index" onclick="index();">查看消防器材
            </a></p>
        </div>
    </div>
</nav>
<!--主体-->
<iframe src="/index" width="100%" height="920px" frameborder="0" name="voiceList" scrolling="no" id="iframe"></iframe>
</body>

<script>

    var app = new Vue({
        el: '#app1',
        data: {
            isLogin:'',
            menu:{
                toCar:'',
                toBill:'',
                index:'',
                toUserInfo:'',
                toComment:'',
            },
            choose:'choose'
        },
        methods: {
        }
    });
    function toBill() {
        renew();
        app.menu.toBill=app.choose;
        $("iframe").attr("src","/toBill");
    }
    function index() {
        renew();
        app.menu.index=app.choose;
        $("iframe").attr("src","/index");
    }
    function toCar() {
        renew();
        app.menu.toCar=app.choose;
        $("iframe").attr("src","/toCar");
    }
    function toUserInfo(){
        renew();
        app.menu.toUserInfo=app.choose;
        $("iframe").attr("src","/userInfo");
    }
    function toComment(){
        renew();
        app.menu.toComment=app.choose;
        $("iframe").attr("src","/comment");
    }
    function quit(){
        var params1={
        }
        $.ajax({
            type : "post",
            url : "/user/quit",
            data : params1,
            success : function(data) {
                if (data.code==200){
                    top.document.location.href='/login'
                }
            }
        });
    }
    function renew(){
        app.menu={
            toCar:'',
            toBill:'',
            index:'',
            toUserInfo:'',
            toComment:'',
        };
    }
    $(document).ready(function(){
        var params1={
            pageNum:1,
            pageSize:4,
        }
        $.ajax({
            type : "post",
            url : "/user/getMenu",
            data : params1,
            success : function(data) {
                app.isLogin=data.isLogin;
                app.menu.index=app.choose;
            }
        });
    })
</script>
</html>